package com.game.rpc.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.game.rpc.IWeixinService;
import com.game.util.GsonUtils;
import com.game.util.HttpRequestProxy;
import com.game.util.WeixinConfig;

@Service
public class WeixinService implements IWeixinService {
	
	@Autowired
	private WeixinConfig weixinConfig;

	
	@Override
	public Map<String, String> code2session(String js_code) {
		
		String js2codeurl = weixinConfig.getJs2codeUrl();
		js2codeurl = String.format(js2codeurl,weixinConfig.getAppid(),weixinConfig.getAppsecret(),js_code);
		String result = HttpRequestProxy.doGet(js2codeurl, "UTF-8");
		return GsonUtils.gsonToMaps(result);
	}


}
